package com.dhj.jvmstudy.chapter06;

import com.alibaba.fastjson.JSONObject;

import java.lang.reflect.Constructor;

/**
 * 对象的创建
 */
public class NewObject {

    public static void main(String[] args) throws Exception {
        NewObject object1 = new NewObject();

        NewObject object2 = NewObject.getObj();

        NewObject object3 = (NewObject) Class.forName("NewObject").newInstance();

        NewObject object4 = (NewObject) Constructor.class.newInstance().newInstance("NewObject");

        NewObject object5 = (NewObject) object1.clone();

        NewObject object6 = JSONObject.parseObject("{}", NewObject.class);

    }


    public static NewObject getObj(){
        return new NewObject();
    }

}
